package com.ruoyi.factorydata.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.factorydata.domain.dto.HomePlanedProductionDTO;
import com.ruoyi.factorydata.domain.dto.HomeTopRankProjectDTO;
import com.ruoyi.factorydata.domain.dto.HomeWorkOrderLineDTO;
import com.ruoyi.factorydata.service.IHomeStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/homeStatistics/homeStatistics")
public class HomeStatisticsController extends BaseController {

    @Autowired
    private IHomeStatisticsService homeStatisticsService;

    @PostMapping("/getHomePlanedProduction")
    public AjaxResult getHomePlanedProduction(@RequestBody(required = false) HomePlanedProductionDTO homePlanedProductionDTO){
        return AjaxResult.success(homeStatisticsService.getHomePlanedProduction(homePlanedProductionDTO));
    }

    @PostMapping("/getHomeWorkOrderLineData")
    public AjaxResult getHomeWorkOrderLineData(@RequestBody(required = false) HomeWorkOrderLineDTO homeWorkOrderLineDTO){
        return AjaxResult.success(homeStatisticsService.getHomeWorkOrderLineData(homeWorkOrderLineDTO));
    }

    @PostMapping("/getHomeTopRankProject")
    public AjaxResult getHomeTopRankProject(@RequestBody(required = false) HomeTopRankProjectDTO homeTopRankProjectDTO){
        return AjaxResult.success(homeStatisticsService.getHomeTopRankProject(homeTopRankProjectDTO));
    }
}
